<!-- 录制列表 -->
<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="detailsList" class="mt-20">
      <el-table-column label="ID" width="80" prop="id" align="center" />
      <el-table-column
        label="录制名称"
        width="200"
        prop="videoName"
        align="center"
      />
      <el-table-column
        label="录制人"
        width="100"
        prop="userName"
        align="center"
      />
      <el-table-column label="在线播放" width="150" align="center">
        <template slot-scope="{ row }">
          <el-button type="success" size="mini" @click="playVideo(row)"
            >在线播放</el-button
          >
        </template>
      </el-table-column>
      <el-table-column label="下载地址" align="center">
        <template slot-scope="{ row }">
          <el-link
            type="primary"
            :href="row.ossUrl || row.xyUrl"
            target="_blank"
            >{{ row.ossUrl || row.xyUrl }}</el-link
          >
        </template>
      </el-table-column>
      <el-table-column
        label="创建时间"
        prop="createTime"
        align="center"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
    </el-table>

    <el-dialog
      :title="title"
      :visible.sync="open"
      width="1100px"
      append-to-body
    >
      <video :src="playUrl" width="1060px" controls autoplay></video>
    </el-dialog>
  </div>
</template>

<script>
import { recordList } from "@/api/order/order";
export default {
  name: "VideoList",
  dicts: ["calltype", "startname", "billtype"],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 咨询详情表格数据
      detailsList: [],
      open: false,
      title: "",
      //   播放地址
      playUrl: "",
    };
  },
  created() {
    const orderId = this.$route.params && this.$route.params.orderId;
    this.getList(orderId);
  },
  methods: {
    /** 查询咨询详情列表 */
    getList(orderId) {
      this.loading = true;
      recordList({ orderId }).then((response) => {
        this.detailsList = response.data;
        this.loading = false;
      });
    },
    playVideo(row) {
      this.open = true;
      this.title = "正在播放：" + row.videoName;
      this.playUrl = row.ossUrl || row.xyUrl;
    },
  },
};
</script>
